﻿using Propro.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace Propro.Controllers
{
    public class MyProjectsController : Controller
    {
        private ProWebContext _db = new ProWebContext();

        public ActionResult Index()
        {
            if (User.Identity.IsAuthenticated)
            {
                var model =_db.Users.Where(u => u.UserName == User.Identity.Name).First().Projects;
                return View(model);
            }
            return RedirectToAction("List", "Projects");
        }

        protected override void Dispose(bool disposing)
        {
            if (_db != null)
            {
                _db.Dispose();
            }

            base.Dispose(disposing);
        }

    }
}
